All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.sun.java.swing.ProgressMonitor

java.lang.Object
   |
   +----com.sun.java.swing.ProgressMonitor

public class ProgressMonitor
extends Object
A class to monitor the progress of some operation. If it looks like it will take a while, a progress dialog will be popped up. When the ProgressMonitor is created it is given a numeric range and a descriptive string. As the operation progresses, call the setProgress method to indicate how far along the [min,max] range the operation is. Initially, there is no ProgressDialog. After the first millisToDecideToPopup milliseconds (default 500) the progress monitor will predict how long the operation will take. If it is longer than millisToPopup (default 2000, 2 seconds) a ProgressDialog will be popped up.

From time to time, when the Dialog box is visible, the progress bar will be updated when setProgress is called. setProgress won't always update the progress bar, it will only be done if the amount of progress is visibly significant.

See Also:
ProgressMonitorInputStream

Constructor Index

 o ProgressMonitor(Component, Object, String, int, int)

Method Index

 o close()
Indicate that the operation is complete.
 o getMaximum()
 o getMillisToDecideToPopup()
 o getMillisToPopup()
 o getMinimum()
 o getNote()
 o isCanceled()
Returns true if the user does some UI action to cancel this operation.
 o setMaximum(int)
 o setMillisToDecideToPopup(int)
 o setMillisToPopup(int)
 o setMinimum(int)
 o setNote(String)
 o setProgress(int)
Indicate the progress of the operation being monitored.

Constructors

 o ProgressMonitor
 public ProgressMonitor(Component parentComponent,
                        Object message,
                        String note,
                        int min,
                        int max)
Parameters:
parentComponent - the parent component for the dialog box
message - a descriptive message that will be shown to the user to indicate what operation is being monitored. This does not change as the operation progresses. See the message parameters to methods in JOptionsPane for the range of values.
note - a short note describing the state of the operation. As the operation progresses, you can call setNote to change the note displayed. This is used, for example, in operations that iterate through a list of files to show the name of the file being processes. If note is initially null, there will be no note line in the dialog box and setNote will be ineffective
min - the lower bound of the range
max - the upper bound of the range
See Also:
JDialog, JOptionPane

Methods

 o setProgress
 public void setProgress(int nv)
Indicate the progress of the operation being monitored.

 o close
 public void close()
Indicate that the operation is complete. This happens automatically when the value set by setProgress is >= max, but it may be called earlier if the operation ends early.

 o getMinimum
 public int getMinimum()
 o setMinimum
 public void setMinimum(int m)
 o getMaximum
 public int getMaximum()
 o setMaximum
 public void setMaximum(int m)
 o isCanceled
 public boolean isCanceled()
Returns true if the user does some UI action to cancel this operation. (like hitting the Cancel button on the progress dialog).

 o setMillisToDecideToPopup
 public void setMillisToDecideToPopup(int millisToDecideToPopup)
 o getMillisToDecideToPopup
 public int getMillisToDecideToPopup()
 o setMillisToPopup
 public void setMillisToPopup(int millisToPopup)
 o getMillisToPopup
 public int getMillisToPopup()
 o setNote
 public void setNote(String note)
 o getNote
 public String getNote()

All Packages  Class Hierarchy  This Package  Previous  Next  Index